﻿using System;
using System.Linq.Expressions;
using System.Windows;
using PersonaLibrary.Data;
using PersonaLibrary.Search;
using PersonaLibrary.ViewModel.CollectionViewModel;

namespace PersonaLibrary.Commands.SearchCommands
{
    internal sealed class NavigateToCommand<T> : CommandBase
        where T : class, IDBEntity
    {
    	private string _additionalLoadParametrs;

    	public NavigateToCommand(string additionalLoadParametrs)
    	{
    		_additionalLoadParametrs = additionalLoadParametrs;
    	}

    	public NavigateToCommand()
    	{
    		
    	}

        public override bool CanExecute(object parameter)
        {
            return (parameter != null);
        }

		public override void Execute(object parameter)
		{
			CollectionViewModel<T> vModel = new CollectionViewModel<T>(_additionalLoadParametrs);
			((App) Application.Current).AddViewModel(vModel);
		}
    }
}
